﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Configuration;

namespace Ruandao.Searcher.EntityAccess
{
    using Ruandao.MiniAccess;
    using Ruandao.MiniAccess.SqlServer;
    using Ruandao.Foundation;

    public sealed partial class SearcherAccess
    {
        static readonly SearcherAccess instance = new SearcherAccess();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static SearcherAccess GetInstance()
        {
            return instance;
        }

        private static string GetConnectionString(string providerName)
        {
            string str = ConfigurationManager.AppSettings[providerName + "_Setter"];
            if (string.IsNullOrEmpty(str))
            {
                return ConfigurationManager.ConnectionStrings[providerName].ConnectionString;
            }
            IDataSourceSetter setter = (IDataSourceSetter)Activator.CreateInstance(Type.GetType(str));
            return setter.GetConnectionString();
        }

    }
}
